<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>让一个元素在转换进入阶段之前离开</title>
    <script type="text/javascript" src="https://vuejs.org/js/vue.js"></script>
    <style>
        .slide-enter-active, .slide-leave-active{
            transition: transform .5s;
        }
        .slide-enter{
            transform: translateX(300px);
        }
        .slide-leave-active{
            transform: translateX(-300px);
        }
        p{
            margin:0;
            font-size: 3em;
        }
    </style>
</head>
<body>

<div id="app">
    <button @click="product++">next</button>
    <transition name="slide" mode="out-in">
        <p :key="products[product % 4]">{{products[product % 4]}}</p>
    </transition>

</div>

<script>
    new Vue({
        el: '#app',
        data:{
            product: 0,
            products: ['☂umbrella', '💻computer', '⚽ball', '📷camera']
        }
    })
</script>

</body>
</html>